import 'dart:convert';
import 'package:http/http.dart' as http;

class WordsApi {
  /// 获取远程词汇数据
  static getWords(String baseUrl) async {
    final response = await http.get(Uri.parse(baseUrl),headers: {'Content-Type': 'application/json; charset=UTF-8'},);
    if (response.statusCode == 200) {
      final jsonData = utf8.decode(response.bodyBytes);
      return json.decode(jsonData);
    } else {
      // 处理错误情况
      throw Exception('Failed to load data');
    }
  }

}